<div>
  <div class="d-input">
      <input dTextInput style="width: 180px;" [error]="false" placeholder="销售报价单" name="销售报价单"
        [(ngModel)]="fifter.QuotationNum">
      <input *ngIf="!this.data.customerName" dTextInput style="width: 180px;" [error]="false" placeholder="客户名称" [(ngModel)]="fifter.CustomerName">
      <input dTextInput style="width: 180px;" [error]="false" placeholder="物料编码/名称" [(ngModel)]="fifter.PartName">
      <d-range-datepicker-pro name="制单日期" [placeholder]="['制单日期：起始','制单日期：截止']" [(ngModel)]="creatTime"
        (ngModelChange)="dateChange()"></d-range-datepicker-pro>
      <d-button id="primaryBtn" style="margin-left: 8px" (btnClick)="filter2()"><i
          class="icon icon-filter-o me-2"></i>查询</d-button>
      <d-button bsStyle="common" (btnClick)="reset()"> <i class="icon icon-refresh me-2"></i>重置</d-button>
  </div>
  <div class="mt-3">
    <d-data-table [dataSource]="tableData" [lazy]="true" [scrollable]="true" [fixHeader]="true"
    [tableWidthConfig]="tableWidthConfig" [tableOverflowType]="'auto'" [scrollable]="true"
    (checkAllChange)="getCheckedRows();getCheckedRowsData()" (rowCheckChange)="getCheckedRows();getCheckedRowsData()" [resizeable]="true" [maxHeight]="'400px'">
    <thead dTableHead [checkable]="true">
      <tr dTableRow>
        <th dHeadCell *ngFor="let colOption of dataTableOptions.columns" [fixedLeft]="colOption.fixedLeft">{{ colOption.header }}</th>
      </tr>
    </thead>
    <tbody dTableBody>
      <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex" let-nestedIndex="nestedIndex">
        <tr dTableRow>
          <td dTableCell [fixedLeft]="'0px'">
            <d-checkbox [disabled]="false" [showAnimation]="true" [ngModelOptions]="{ standalone: true }"
              [ngModel]="rowItem.$checked" dTooltip [halfchecked]="rowItem.$halfChecked" [showGlowStyle]="false" [disabled]="this.data.quotationItemId.includes(rowItem.quotationItemId)"
              (ngModelChange)="onRowCheckChange($event, rowIndex, nestedIndex, rowItem)"></d-checkbox>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'" [fixedLeft]="'80px'">
            <span dTooltip [content]="rowItem?.quotation?.quotationNum">{{ rowItem?.quotation?.quotationNum }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem?.quotation?.creationDate | date:'yyyy-MM-dd'">{{ rowItem?.quotation?.creationDate | date:'yyyy-MM-dd' }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem?.quotation?.customerShortName">{{ rowItem?.quotation?.customerShortName }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.quotation?.salesmanName">{{ rowItem.quotation?.salesmanName }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.quotation?.department">{{ rowItem.quotation?.department }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.partNum">{{ rowItem.partNum }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.partName">{{ rowItem.partName }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.partType">{{ rowItem.partType }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.partUOM">{{ rowItem.partUOM }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.quantity">{{ rowItem.quantity }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="(rowItem.quantity - rowItem.transQuantity).toString()">{{ rowItem.quantity - rowItem.transQuantity }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.priceWithTax">{{ rowItem.priceWithTax }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.amountWithTax">{{ rowItem.amountWithTax }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.taxAmount">{{ rowItem.taxAmount }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.discount | percent">{{ rowItem.discount | percent }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.discountedPriceWithTax">{{ rowItem.discountedPriceWithTax }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.discountedAmountWithTax">{{ rowItem.discountedAmountWithTax }}</span>
          </td>
          <td dTableCell [rowItem]="rowItem" [field]="'showType'">
            <span dTooltip [content]="rowItem.discountedTaxAmount">{{ rowItem.discountedTaxAmount }}</span>
          </td>
        </tr>
      </ng-template>
    </tbody>
  </d-data-table>
  </div>
  <div class="page-footer">
    <div>
      <p>已选 <span class="underline">{{CheckedRows.length}}</span> 条
        <a (click)="cleared()" class="cleared">清空</a>
      </p>
    </div>
    <d-pagination
      [size]="'sm'"
      [canViewTotal]="true"
      [canChangePageSize]="true"
      [maxItems]="5"
      [total]="this.pager.total"
      [pageSizeOptions]="this.pageSizeOptions"
      [(pageSize)]="pager.pageSize"
      [(pageIndex)]="pager.pageIndex"
      (pageIndexChange)="pageIndexChange($event)"
      (pageSizeChange)="pageSizeChange($event)"
    >
    </d-pagination>
  </div>
</div>
